const path = require("path")
const { merge } = require("webpack-merge")
const baseConfig = require("./webpack.base")
// 服务端代码运行在 node 的环境，这里可以剔除 node 的系统模块，避免打包体积太大
const nodeExternals = require("webpack-node-externals")

const config = {
	target: "node",
	externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
	entry: "./src/server/index.js",
	output: {
		path: path.join(__dirname, "build"),
		filename: "bundle.js",
	},
}

module.exports = merge(config, baseConfig)
